<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
		<title>代金券</title>
		<link rel="stylesheet" type="text/css" href="css/public.css" />
		<link rel="stylesheet" type="text/css" href="css/code.css?v=006" />
	</head>
	<body>
		<div class="content" id="list">
			<!-- <div class="code_box">
				<a href="getcode.html"><img src="img/jimei_bg.png" /></a>
			</div>
			<div class="code_box">
				<a href="getcode.html"><img src="img/huixiang_bg.png" /></a>
			</div>
			<div class="code_box">
				<a href="getcode.html"><img src="img/yonghui_bg.png" /></a>
			</div>
			<div class="btn" onclick="window.location.href='mycode.html'">我的代金券</div>
			<a href="disclaimer.html" class="a">免责声明</a> -->
		</div>
		<script src="layui/layui.js" charset="utf-8"></script>
		<script>
			layui.use(['element', 'layer', 'jquery'], function () {
				var layer = layui.layer,
					element = layui.element,
				    $ = layui.jquery;
				layer.ready(function(){
					//加载活动场所
				    $.ajax({
				    	url:"http://redmany.city1000.cn/red/get/shangdian",
				    	type: "get",
				    	beforeSend:function(){
				    		//弹出的lodinng层
				    	    layer.load(2,{
				    	        shade:[0.5,"#333"]
				    	    });            
				    	},
				    	success: function(res) {
				    		res.list.forEach(item=>{
				    			console.log(item);
				    			var child = '<div class="code_box" onclick="getCode('+item.id+')">';
				    			child += '<img src="'+item.imgUrl+'" />';
				    			child += '</div>';
				    			$('#list').append(child);
				    		})
							$('#list').append('<div class="btn" onclick="myCode()">我的代金券</div>');
							$('#list').append('<span class="a" onclick="window.location.href=\'disclaimer.html\'">免责声明</span>');
						},
				    	error:function() { 
				    		layer.msg("请求失败！");
				    	},
				    	complete:function(){
				    		//关掉loading
				    		layer.closeAll("loading")
				    	}
				    });                   
				});
				window.getCode=function(id){
					window.location.href = 'http://redmany.city1000.cn/red/zhuanfa/http:--hesuan.city1000.cn-daijinquan-getcode.html/'+id;
				}
				window.myCode=function(){
					window.location.href = 'http://redmany.city1000.cn/red/zhuanfa/http:--hesuan.city1000.cn-daijinquan-mycode.html';
				}
			});
		</script>
	</body>
</html>
